function bytesToSize(bytes,len=2) {
  if (bytes === 0) return '0 B';

  var k = 1024;

  var sizes = ['B','KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

  var i = Math.floor(Math.log(bytes) / Math.log(k));

  return (bytes / Math.pow(k, i)).toFixed(len) + ' ' + sizes[i];
  //toPrecision(3) 后面保留一位小数，如1.0GB                                                                                                                  //return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}

function rangeColor() {
  var color="#";
  for(var i=0;i<6;i++){
    color += (Math.random()*16 | 0).toString(16);
  }
  return color;
}
export {bytesToSize,rangeColor}
